package cn.zjq.one;

public class Student {
    private String name;
    private String no;
    private int age;
    private String school;

    public Student() {
    }

    public Student(String name, String no, int age, String school) {
        this.name = name;
        this.no = no;
        this.age = age;
        this.school = school;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) throws IllegleSnoException{
        int length=no.length();
        if(length<8){
            throw new IllegleSnoException("学号长度不能小少于8个数字");
        }
        this.no = no;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) throws IllegleSageException{
        if(age>=0&&age<=200){
            this.age = age;
        }
        else{
            throw new IllegleSageException("学院年龄必须在0到200之间");
        }
    }

    public String getSchool() {
        return school;
    }

    public void setSchool(String school) {
        this.school = school;
    }

    public void printlnfor() {
        System.out.println("我叫"+this.getName()+",今年"+this.getAge()+"岁，就读于"+this.getSchool()+"，学号是"+this.getNo());
    }
}
